package cn.sz.tm.control;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.sz.tm.pojo.Account;
import cn.sz.tm.pojo.User;
import cn.sz.tm.service.AccountService;

@Controller
@RequestMapping("/ac")
public class AccountController {

	@Autowired
	private AccountService accService;
	
	@RequestMapping(value="findacc",method=RequestMethod.POST)
	@ResponseBody
	public List<Account> findAcc(HttpServletRequest request) {
		HttpSession session = request.getSession();
		User u = (User) session.getAttribute("myuser");
		List<Account> acclist = accService.findAccByUserid(u.getUserid());
		return acclist;
	}
	
}
